<?php
namespace App\Console\Commands;


use App\Http\Services\MaximumGoldServices;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Redis;

/**
 * 房间周榜数据修复
 */
class UpdateMaxGoldDataCommand extends Command
{

    // time : 基准时间  房间加入最多金之后的第一条流水记录时间
    // type : 默认为0  从普通榜单迁移至最多金
    protected $signature = 'maxGoldData:updateCharts {--time=} {--type=?} {--roomids=?}';


    protected $description = '最多金排行榜数据修复';

    public function __construct()
    {
        parent::__construct();
    }

    public function handle() {
        $time = (int) $this->option('time');
        $type = (int) $this->option('type');
        $roomids = $this->option('roomids');
        $roomidsArr = array();
        if ($roomids && $roomids != '?') {
            $roomidsArr = explode(',', $roomids);
        }
        // $timeStr = date('Y-m-d H:i:s', $time);
        $maximumGoldServices = new MaximumGoldServices();
        $maximumGoldServices->updateMonthChartsCache($time, $type, $roomidsArr);
    }

}